/**
 * 
 */
package it.unitn.testbed.server.task;

import java.util.ArrayList;

// TODO move contents to file and do not store it into memory
/**
 * Holds a mapping between a TinyOS image and the actual mote IDs where the
 * image should be ran.
 * 
 * @author Stefan Guna
 * 
 */
public class TaskComponent {
	private static long last_id = 0;
	/** Contents of the binary. */
	private byte[] fileContents;
	/** The name of the file. */
	private String fileName;
	private long id = 0;
	/** List of motes where {@link #fileName} should be programmed onto. */
	private ArrayList<Integer> motes;

	/**
	 * Build a new TaskComponent instance.
	 * 
	 * @param motes
	 *            Mote IDs where to program the binary.
	 * @param fileName
	 *            Name of the binary file.
	 * @param fileContents
	 *            Contents of the binary file.
	 */
	public TaskComponent(ArrayList<Integer> motes, String fileName,
			byte[] fileContents) {
		this.motes = motes;
		this.fileName = fileName;
		this.fileContents = fileContents;
		synchronized (TaskComponent.class) {
			id = last_id++;
		}
	}

	/**
	 * @return the fileContents
	 */
	public byte[] getFileContents() {
		return fileContents;
	}

	/**
	 * @return the fileName
	 */
	public String getFileName() {
		return fileName;
	}

	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * @return the motes
	 */
	public ArrayList<Integer> getMotes() {
		return motes;
	}
}
